﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FuncoesCadastro.aspx.cs" Inherits="_FuncoesCadastro" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">


	
.style7 {font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; }

    ul {
    list-style: none;
    padding: 0px;
    margin-left:10px;
    background-color:#FFFFFF
    } 
    .style6 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
}

    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
                                <table style="width:500px;">
                                    <tr>
                                        <td align="right">
                                            <asp:Label runat="server" Text="Segmento:" CssClass="style7" Font-Bold="True" 
                                                ID="Label9"></asp:Label>

                                        </td>
                                        <td align="left">
                                        <asp:DropDownList ID="ddSegmento" runat="server" AutoPostBack="True">
                                            <asp:ListItem></asp:ListItem>
                                            <asp:ListItem Value="adm">ADMINISTRATIVO</asp:ListItem>
                                            <asp:ListItem Value="loj">LOJISTA</asp:ListItem>
                                            <asp:ListItem Value="ope">OPERAÇÕES/INFRAESTRUTURA</asp:ListItem>
                                            <asp:ListItem Value="aeb">ALIMENTOS E BEBIDAS</asp:ListItem>
                                        </asp:DropDownList>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label runat="server" Text="Função" CssClass="style7" Font-Bold="True" 
                                                ID="Label3"></asp:Label>

                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtFuncao" runat="server" MaxLength="100" Width="300px"></asp:TextBox>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            &nbsp;</td>
                                        <td align="left">
                                            <asp:Label runat="server" ID="lblMensagem" ForeColor="Blue"></asp:Label>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            &nbsp;</td>
                                        <td align="right">
                                            <asp:ImageButton runat="server" ValidationGroup="gRevisores" 
                                                ImageUrl="../figuras/bcadastrar.gif" ID="btnCadastrar" 
                                                OnClick="bCadastrarRevisor_Click"></asp:ImageButton>

                                            <asp:ValidationSummary runat="server" ShowMessageBox="True" ShowSummary="False" 
                                                ValidationGroup="gRevisores" ID="ValidationSummary1"></asp:ValidationSummary>

                                            <asp:RequiredFieldValidator runat="server" ControlToValidate="ddSegmento" 
                                                ErrorMessage="Informe o segmento" Display="None" 
                                                ValidationGroup="gRevisores" ID="RV1"></asp:RequiredFieldValidator>

                                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtFuncao" 
                                                ErrorMessage="Informe a função" Display="None" 
                                                ValidationGroup="gRevisores" ID="RV2"></asp:RequiredFieldValidator>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <img alt="Revisores cadastrados" src="../figuras/gFuncoesSegmento.gif" 
                                                style="width: 225px; height: 32px" /></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:GridView runat="server" AllowPaging="True" AutoGenerateColumns="False" 
                                                CellPadding="4" DataKeyNames="CodFuncao" EnableModelValidation="True" 
                                                GridLines="None" DataSourceID="dsFuncoes" CssClass="style6" 
                                                ForeColor="#333333" Width="100%" ID="GridView1">
<AlternatingRowStyle BackColor="White" ForeColor="#284775"></AlternatingRowStyle>
<Columns>
<asp:TemplateField HeaderText="Função" SortExpression="Funcao">
<ItemTemplate>
                                                            <asp:Label ID="Label10" runat="server" Text='<%# Bind("Funcao") %>'></asp:Label>
                                                        
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>

<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="A&#231;&#245;es" ShowHeader="False">
    <EditItemTemplate>
                                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                                                CommandName="Update" Text="Atualizar"></asp:LinkButton>
                                                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                                                CommandName="Cancel" Text="Cancelar"></asp:LinkButton>
                                                        
</EditItemTemplate>
<ItemTemplate>
                                                            &nbsp;<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" 
                                                                CommandName="Delete" Text="Excluir" 
                                                                onclientclick="return confirm('Deseja excluir a função?')"></asp:LinkButton>
                                                        
</ItemTemplate>

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>

<EditRowStyle BackColor="#999999"></EditRowStyle>

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></FooterStyle>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></HeaderStyle>

<PagerStyle HorizontalAlign="Center" BackColor="#284775" ForeColor="White"></PagerStyle>

<RowStyle BackColor="#F7F6F3" ForeColor="#333333"></RowStyle>

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"></SelectedRowStyle>
</asp:GridView>

                                            <asp:SqlDataSource ID="dsFuncoes" runat="server" 
                                                ConnectionString="<%$ ConnectionStrings:conexao_intranet %>" 
                                                ProviderName="<%$ ConnectionStrings:conexao_intranet.ProviderName %>" 
                                                SelectCommand="SELECT CodFuncao, Funcao FROM CamaraFuncoes WHERE Segmento = @segmento ORDER BY Funcao"
                                                DeleteCommand="DELETE FROM CamaraFuncoes WHERE CodFuncao = @codfuncao"
                                                >
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddSegmento" Name="segmento" 
                                                        PropertyName="SelectedValue" />
                                                </SelectParameters>
                                            </asp:SqlDataSource>

                                        </td>
                                    </tr>
                                </table>
    
    </div>
    </form>
</body>
</html>
